import { defineStore } from 'pinia';
import { ref, computed } from 'vue';
export default defineStore("loading", () => {
  const loadingCount = ref(0);
  function increment() {

    loadingCount.value++;
  }
  function decrement() {
    if (loadingCount.value <= 0) return;
    loadingCount.value--;
  }
  // 显示loading
  const isLoading = computed(() => {
    return loadingCount.value > 0;
  })
  return {
    isLoading,
    increment,
    decrement
  }
})
